package cn.com.hbhgkj.dao.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import cn.com.hbhgkj.dao.CopyrightApplicationDao;
import cn.com.hbhgkj.model.CopyrightApplication;
import cn.com.hbhgkj.model.User;

@Repository("copyrightApplicationDao")
public class CopyrightApplicationDaoHibernate extends
		GenericDaoHibernate<CopyrightApplication, Long> implements
		CopyrightApplicationDao {

	public CopyrightApplicationDaoHibernate() {
		super(CopyrightApplication.class);
	}

	@Override
	public List<CopyrightApplication> findByApplicant(User applicant) {
		Session sess = getSession();
		Criteria criteria = sess.createCriteria(CopyrightApplication.class);
		criteria.add(Restrictions.eq("applicant", applicant));
        return criteria.list();
	}

}
